package com.connectlinkcorp.common.ui.demo;

import com.connectlinkcorp.common.ui.energybar.EnergyBar;

import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class EnergyBarActivity extends Activity implements OnClickListener{

	EnergyBar energyBarView;
	Button btnStart;
	Button btnStop;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_energybar);
		
		energyBarView = (EnergyBar)findViewById(R.id.energyBarView);
		btnStart = (Button)findViewById(R.id.btnStart);
		btnStop= (Button)findViewById(R.id.btnStop);
		btnStart.setOnClickListener(this);
		btnStop.setOnClickListener(this);
		
		
		energyBarView.setUpParam(EnergyBar.HORIZONTAL, 10000, 100, 100, 200, 30, this);
		
		// default color for bar is Red, progress bar is white;
		// set background color with this will configure color.
		energyBarView.setBackgroundEnergyBar(Color.BLUE);
		energyBarView.setBacgroundProgressBar(Color.GREEN);
		
		
		energyBarView.show();
		
	}

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		switch (v.getId()) {
		case R.id.btnStart:
			energyBarView.start();
			break;
			
		case R.id.btnStop:
			energyBarView.stop();
			break;

		default:
			break;
		}
	}

}
